package fun.tan90.easy.binlog.manager.dataobject.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;

/**
 * 表定义层。
 *
 * @author 陈浩杰
 * @since 2023-09-01
 */
public class BinlogMasterTableDef extends TableDef {

    /**
     *
     */
    public static final BinlogMasterTableDef BINLOG_MASTER = new BinlogMasterTableDef();

    /**
     * 主键
     */
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * master 端口
     */
    public final QueryColumn PORT = new QueryColumn(this, "port");

    /**
     * 创建人
     */
    public final QueryColumn CREATE_ID = new QueryColumn(this, "create_id");

    /**
     * binlog 文件名
     */
    public final QueryColumn FILENAME = new QueryColumn(this, "filename");

    /**
     * master 地址
     */
    public final QueryColumn HOSTNAME = new QueryColumn(this, "hostname");

    /**
     * 密码
     */
    public final QueryColumn PASSWORD = new QueryColumn(this, "password");

    /**
     * binlog position
     */
    public final QueryColumn POSITION = new QueryColumn(this, "position");

    /**
     * 服务ID
     */
    public final QueryColumn SERVER_ID = new QueryColumn(this, "server_id");

    /**
     * 更新人
     */
    public final QueryColumn UPDATE_ID = new QueryColumn(this, "update_id");

    /**
     * 用户名
     */
    public final QueryColumn USERNAME = new QueryColumn(this, "username");

    /**
     * 是否keepalive
     */
    public final QueryColumn KEEP_ALIVE = new QueryColumn(this, "keep_alive");

    /**
     * slave客户端名称
     */
    public final QueryColumn MASTER_NAME = new QueryColumn(this, "master_name");

    /**
     * slave客户端编号
     */
    public final QueryColumn MASTER_CODE = new QueryColumn(this, "master_code");

    /**
     * 主库版本
     */
    public final QueryColumn MASTER_VERSION = new QueryColumn(this, "master_version");

    /**
     * 创建时间
     */
    public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");

    /**
     * 更新时间
     */
    public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

    /**
     * slave客户端状态 0 停止  1 开启
     */
    public final QueryColumn SLAVE_CLIENT_STATUS = new QueryColumn(this, "slave_client_status");

    /**
     * slave所在工作节点ID
     */
    public final QueryColumn SLAVE_WORK_ID = new QueryColumn(this, "slave_work_id");

    /**
     * slave开启结果信息
     */
    public final QueryColumn SLAVE_OPEN_RES = new QueryColumn(this, "slave_open_res");

    /**
     * 连接超时时间 ms
     */
    public final QueryColumn CONNECT_TIMEOUT = new QueryColumn(this, "connect_timeout");

    /**
     * 心跳时间间隔 ms
     */
    public final QueryColumn HEARTBEAT_INTERVAL = new QueryColumn(this, "heartbeat_interval");

    /**
     * keepalive时间间隔 ms
     */
    public final QueryColumn KEEP_ALIVE_INTERVAL = new QueryColumn(this, "keep_alive_interval");

    /**
     * 最近心跳时间
     */
    public final QueryColumn HEARTBEAT_TIME = new QueryColumn(this, "heartbeat_time");

    /**
     * 二进制文件信息更新时间
     */
    public final QueryColumn ROTATE_UPDATE_TIME = new QueryColumn(this, "rotate_update_time");

    /**
     * 时间偏移量
     */
    public final QueryColumn OFFSET_MILLISECONDS = new QueryColumn(this, "offset_milliseconds");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, MASTER_NAME, MASTER_CODE, HOSTNAME, PORT, USERNAME, PASSWORD, KEEP_ALIVE, KEEP_ALIVE_INTERVAL, HEARTBEAT_INTERVAL, CONNECT_TIMEOUT, SERVER_ID, OFFSET_MILLISECONDS, FILENAME, POSITION, ROTATE_UPDATE_TIME, SLAVE_CLIENT_STATUS, HEARTBEAT_TIME, MASTER_VERSION, SLAVE_WORK_ID, SLAVE_OPEN_RES, CREATE_ID, CREATE_TIME, UPDATE_ID, UPDATE_TIME};

    public BinlogMasterTableDef() {
        super("", "binlog_master");
    }

}
